import fetch from 'utils/fetch';
// 点击任教班级按钮
export function listTeacherClass(teacherId) {
    const data = {
        teacherId,
    };
    return fetch({
        url: '/teacher/listTeacherClass',
        method: 'post',
        data
    });
}

// 点击任教班级 删除按钮
export function removeTeacherClass(teacherId,schoolId,classId,relationId) {
    const data = {
        teacherId,
        schoolId,
        classId,
        relationId
    };
    return fetch({
        url: '/teacher/removeTeacherClass',
        method: 'post',
        data
    });
}
// 点击任教班级 添加按钮
export function insertTeacherClass(teacherId,schoolId,classId, subjectId,subject) {
    const data = {
        teacherId,
        schoolId,
        classId,
        subjectId,
        subject
    };
    return fetch({
        url: '/teacher/insertTeacherClass',
        method: 'post',
        data
    });
}


// 删除班级教师关系
export function delTeaMap(teacherId, schoolId, classId) {
    const data = {
        teacherId,
        schoolId,
        classId
    };
    return fetch({
        url: '/teacher/removeClassTeacherMap',
        method: 'post',
        data
    });
}

//年级

export function getGrade(periodId, year) {
    const data = {
        periodId,
        year
    };
    return fetch({
        url: '/teacher/getGradeBySchool',
        method: 'post',
        data
    });
}

//班级
// /teacher/getClassByGrade
export function getClass(grade, schoolId) {
    const data = {
        grade,
        schoolId
    };
    return fetch({
        url: '/teacher/getClassByGrade',
        method: 'post',
        data
    });
}

// 培训机构 学校->班级

export function listClassBySchool(schoolId) {
    const data = {
        schoolId
    };
    return fetch({
        url: '/teacher/listClassBySchool',
        method: 'post',
        data
    });
}

// 添加教师信息
export function addTeaInfor(schoolId, name, phone, sex, schoolName) {
    const data = {
        schoolId,
        name,
        phone,
        sex,
        schoolName
    };
    return fetch({
        url: '/teacher/saveTeacher',
        method: 'post',
        data
    });
}

//分页查询
export function getTeachersByPage(curPage, pageSize, provinceId, cityId, areaId, schoolId, subjectId, name, phone, exueCode) {
    const data = {
        curPage,
        pageSize,
        provinceId,
        cityId,
        areaId,
        schoolId,
        subjectId,
        name,
        phone,
        exueCode
    };
    return fetch({
        url: '/teacher/getTeachersByPage',
        method: 'post',
        data
    });
}


//初始化密码
export function initPassword(teacherId) {
    const data = {
        teacherId
    };
    return fetch({
        url: '/teacher/initPassword',
        method: 'post',
        data
    });
}


//(批量)删除
export function batchDeleteTeacher(teacherIds) {
    const data = {
        teacherIds
    };
    return fetch({
        url: '/teacher/batchDeleteTeacher',
        method: 'post',
        data
    });
}

//批量删除教师轮询接口
export function batchDeleteTeacherProgress(timeStamp) {
    const data = {
        timeStamp
    };
    return fetch({
        url: '/teacher/batchDeleteTeacherProgress',
        method: 'post',
        data
    });
}

//批量导入教师轮询接口
export function batchImportForTeacherProgress(timeStamp, schoolId) {
    const data = {
        timeStamp,
        schoolId
    };
    return fetch({
        url: '/teacher/batchImportForTeacherProgress',
        method: 'post',
        data
    });
}

//查询教师信息
export function getTeacherDetail(teacherId) {
    const data = {
        teacherId
    };
    return fetch({
        url: '/teacher/getTeacherDetail',
        method: 'post',
        data
    });
}


//根据名称模糊查询科目
export function querySubjectByName(subjectName) {
    const data = {
        subjectName
    };
    return fetch({
        url: '/teacher/getSubjectByName',
        method: 'post',
        data
    });
}
//修改页面 

//职称
export function queryWorkCall() {
    const data = {};
    return fetch({
        url: '/teacher/getTitles',
        method: 'post',
        data
    });
}
// 保存修改

export function saveChangeInfor(teacherId, name, sex,
    certificateType, certificateNumber, birth, maritalStatus,
    phone, provinceId, cityId, areaId, jobNumber, professional,
    teachAge, certification, certificationNumber, email, address, lists,
    provinceName, cityName, areaName) {
    const data = {
        teacherId,
        name,
        sex,
        certificateType,
        certificateNumber,
        birth,
        maritalStatus,
        phone,
        provinceId,
        cityId,
        areaId,
        jobNumber,
        professional,
        teachAge,
        certification,
        certificationNumber,
        email,
        address,
        lists, //任教栏目数组
        provinceName,
        cityName,
        areaName
    };
    return fetch({
        url: '/teacher/updateTeacher',
        method: 'post',
        data
    });
}


//证件类型
export function cardType() {
    const data = {};
    return fetch({
        url: '/teacher/getIdType',
        method: 'post',
        data
    });
}

//上传文件校验
export function verifyTeacherForImport(url, fileName, schoolId) {
    const data = {
        url,
        fileName,
        schoolId
    };
    return fetch({
        url: '/teacher/verifyTeacherForImport',
        // url: '/teacher/verifyTeacherForImportOptimize',
        method: 'post',
        data
    })
}

//上传文件
export function batchImportForTeacher(schoolId) {
    const data = {
        schoolId
    };
    return fetch({
        url: '/teacher/batchImportForTeacher',
        method: 'post',
        data
    });
}